package com.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.entity.Admin;
import com.service.AdminService;

@RequestMapping("/admin")
@Controller
public class AdminController {
	
	@Autowired
	private AdminService as;
	
	
	@RequestMapping("/login_submit")
	public String login_submit(HttpSession session,String adminAccount,String adminPwd){
		
		Admin loginList=as.isByAdmin(adminAccount, adminPwd);
		//System.out.println(loginList);
		if(loginList==null){
			
			return "redirect:/index/login";
		}
		session.setAttribute("aId", loginList.getaId());
		session.setAttribute("adminAccount", loginList.getAdminAccount());
		session.setAttribute("adminPwd", loginList.getAdminPwd());
		return "redirect:/index/index";
	}
	
	

	

}
